<template>
    <div>
      <img @click="logoOut" src="~@/assets/images/push/loginout.png" >
    </div>
</template>
<script type="text/babel">
    import { renbao } from "@/services"

    export default{
        data(){
            return{

            }
        },
        mounted(){
          /*const token = localStorage.getItem("token")
          renbao.loginOut({token}).then(res=>{
            if( res.data ) {
              this.$router.push("/login?mode=login")
            }
          })*/
        },
        methods:{
          logoOut() {
            console.log("loginOut")
            const token = localStorage.getItem("renbaoToken")
            renbao.loginOut({ token }).then(res=>{
              if( res.data ) {
                localStorage.removeItem("renbaoToken")
                this.$router.push("/login?mode=login")
              }
            }).catch(res=>{
              this.$toast.show(res.msg)
            })
          }
        }
    }
</script>
<style lang="less" scoped>
  img {
    width: 38px ;
    height: 36px;
  }
</style>

